import 'package:audioplayers/audioplayers.dart';
import 'package:bboy_music_box_2023/bean/bean_datekyes.dart';
import 'package:bboy_music_box_2023/bean/bean_music_manager.dart';
import 'package:bboy_music_box_2023/bean/bean_music_query.dart';
import 'package:bboy_music_box_2023/controllers/ctrl_play.dart';
import 'package:bboy_music_box_2023/pages/page_list_select.dart';
import 'package:bottom_sheet/bottom_sheet.dart';
import 'package:date_format/date_format.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class HomeCtrl extends GetxController {
  static HomeCtrl get to => Get.find();
  final pageIndex = 1.obs;
  final isSheetShow = false.obs;


  DateKeys dateKeys = DateKeys.fromParams(keys: []);

  @override
  void onInit() async {
    super.onInit();

    for (var i = 0; i < 6; i++) {
      String dateKey = formatDate(
          DateTime.now().add(Duration(days: -1 * i)), [yyyy, '-', mm, '-', dd]);
      dateKeys.keys!.add(dateKey);
    }
    print('dateKeys.toString(): ${dateKeys.toString()}');



  }

  void playAndPause() async {
    Music? music = PlayCtrl.to.selectMusic.value.music;
    if (music == null) return;
    await PlayCtrl.to.playOrPause(music);
  }

}
